﻿using System.Runtime.Serialization;

namespace QuailDashboard.View.Web
{
    /// <summary>
    /// The Blob of data
    /// </summary>
    [DataContract]
    public class Blob
    {
        [DataMember]
        private readonly byte[] _data;

        /// <summary>
        /// Initializes a new instance of the <see cref="Blob"/> class.
        /// </summary>
        /// <param name="data">The binary data.</param>
        public Blob(byte[] data)
        {
            _data = data;
        }

        /// <summary>
        /// Gets Data.
        /// </summary>
        public byte[] Data
        {
            get
            {
                return _data;
            }
        }

        /// <summary>
        /// Gets Length.
        /// </summary>
        public int Length
        {
            get
            {
                return _data != null ? _data.Length : 0;
            }
        }
    }
}